﻿using System;
using System.Diagnostics.Contracts;

namespace OpenWaves.ImageTransformations
{
    [DefaultImplementation(typeof(ImageTransformationParser))]
    [ContractClass(typeof(ImageTransformationParserContract))]
    public interface IImageTransformationParser
    {
        bool TryParse(string value, out IImageTransformation transformation);
        IImageTransformation Parse(string value);
    }

    [ContractClassFor(typeof(IImageTransformationParser))]
    abstract class ImageTransformationParserContract : IImageTransformationParser
    {
        public bool TryParse(string value, out IImageTransformation transformation)
        {
            Contract.Requires(String.IsNullOrEmpty(value) == false);
            Contract.Ensures(Contract.Result<bool>() == false || Contract.ValueAtReturn(out transformation) != null);

            throw new System.NotImplementedException();
        }

        public IImageTransformation Parse(string value)
        {
            Contract.Requires(String.IsNullOrEmpty(value) == false);
            Contract.Ensures(Contract.Result<IImageTransformation>() != null);
            
            throw new System.NotImplementedException();
        }
    }
}
